<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
    <!-- 引入vue2的js文件 -->
    <script src="https://cdn.bootcdn.net/ajax/libs/vue/2.7.9/vue.js"></script>
  </head>
  <body>
    <div id="app">
      <div v-if="goodsDetail">
        <img :src="goodsDetail.img1" alt="" />
      </div>
      <button @click="getData">模拟发请求</button>
      <hr />
      <p v-if="score > 90">优秀</p>
      <p v-else-if="score > 80">良好</p>
      <p v-else-if="score > 60">及格</p>
      <p v-else>不合格</p>
    </div>

    <script>
      new Vue({
        el: '#app',
        data: {
          goodsDetail: null,
          score: 80
        },
        methods: {
          getData() {
            setTimeout(() => {
              this.goodsDetail = {
                img1: 'https://img12.360buyimg.com/n1/s450x450_jfs/t1/59022/28/10293/141808/5d78088fEf6e7862d/68836f52ffaaad96.jpg'
              }
            }, 1000)
          }
        }
      })
    </script>
  </body>
</html>
